home *** CD-ROM | disk | FTP | other *** search
- Path: titan.fullerton.edu!etezadi
- From: etezadi@titan.fullerton.edu (Syrous Etezadi Amoli)
- Newsgroups: comp.lang.c++
- Subject: What is wrong with the code please?
- Date: 22 Feb 1996 09:04:25 GMT
- Organization: California State University at Fullerton
- Message-ID: <4ghbip$a68@nuke.csu.net>
- NNTP-Posting-Host: ecs.fullerton.edu
-
- Hi
-
- Please tell me what is wrong with the following code which implements a
- linked list in BC++ 4.5 with TListImp?
-
- #include <classlib\listimp.h>
- #include <iostream.h>
- #include <String.h>
-
- void main()
- {
-
-
- class CIndexListElement : public: string{
- private:
- string subject;
- long start;
- long end;
- public:
-
- DWORD GetStart(void) {return start;};
- DWORD GetEnd(void) { return end;};
- string GetSubject(void) {return subject;};
- void SetStart(DWORD x) {start = x;};
- void SetEnd(DWORD x) {end = x;};
- void SetSubject(string s) { subject = s;};
- private:
-
-
- };
- TListImp<CIndexListElement> m_SubjectList;
-
- CIndexListElement *new_entry= new CIndexListElement;
- new_entry->SetSubject("1st subject");
- new_entry->SetEnd(1);
- new_entry->SetStart(1);
- m_SubjectList.Add(new_entry);
- new_entry->SetSubject("2ND subject");
- new_entry->SetEnd(2);
- new_entry->SetStart(2);
- m_SubjectList.Add(new_entry);
- new_entry->SetSubject("3RD subject");
- new_entry->SetEnd(3);
- new_entry->SetStart(3);
- m_SubjectList.Add(new_entry);
-
- TListIteratorImp<cIndexListElement> next(m_SubjectList);
- cout << "\n The stored items are:\n" << next++;
-
- while (next)
- cout << ", " << next++;
- cout << endl;
- }
-
- --
-
-
-
- --------------
- Syrous Etezadi Amoli (SEA)
- etezadi@titan.fullerton.edu
-